import {getUserProfile} from '../../request/index'
//Page Object
Page({
    data: {
        
    },
    //options(Object)
    onLoad: function(options){
        
    },
    onReady: function(){
        
    },
    onShow: function(){
        
    },
    onHide: function(){

    },
    onUnload: function(){

    },
    onPullDownRefresh: function(){

    },
    onReachBottom: function(){

    },
    onShareAppMessage: function(){

    },
    onPageScroll: function(){

    },
    //item(index,pagePath,text)
    onTabItemTap:function(item){

    },
    
    // 获取用户登录信息
    async handleGetUserInfo() {
        try {
            const {userInfo} = await getUserProfile();
            wx.setStorageSync('userinfo', userInfo); 
            //成功后，回退到先前打开的页面   
            wx.navigateBack({
                delta: 1
            });
        } catch (e) {
            console.log(e);
        }
    }
});